package com.lightheart.sphr.xiaobinggan.design;

import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;

import com.lightheart.sphr.xiaobinggan.R;
import com.lightheart.sphr.xiaobinggan.base.BaseActivity;
import com.lightheart.sphr.xiaobinggan.design.utils.WarpLinearLayout;

import java.util.Random;
//https://blog.csdn.net/u010547228/article/details/49928175
public class RightAutoNextActivity extends BaseActivity {

    private Button btn;
    private WarpLinearLayout warpLinearLayout;

    @Override
    protected int getLayoutId() {
        return R.layout.activity_right_auto_next;
    }

    @Override
    protected void initInjector() {

    }

    @Override
    protected void initView() {
        btn = (Button) findViewById(R.id.btn);
        warpLinearLayout = (WarpLinearLayout) findViewById(R.id.warpLinearLayout);
        btn.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                int n = new Random().nextInt(10) + 5;
                StringBuffer stringBuffer = new StringBuffer();
                Random random = new Random();
                Log.i("WarpLinearLayout", "n=" + n);
                for (int i = 0; i < n; i++) {
                    stringBuffer.append((char) (65 + random.nextInt(26)));
                    Log.i("WarpLinearLayout", "StringBuffer=" + stringBuffer.toString());
                }
                TextView tv = new TextView(RightAutoNextActivity.this);
                tv.setText(stringBuffer.toString() + "000");
                tv.setBackgroundResource(R.drawable.shape_label_item_six);
                tv.setPadding(10, 10, 10, 10);
                warpLinearLayout.addView(tv);
            }
        });
    }


}